package cn.peach.hrm.domain;

import com.baomidou.mybatisplus.enums.IdType;
import com.baomidou.mybatisplus.annotations.TableId;
import com.baomidou.mybatisplus.annotations.TableField;
import com.baomidou.mybatisplus.activerecord.Model;
import com.baomidou.mybatisplus.annotations.TableName;
import lombok.Data;
import javax.validation.constraints.NotEmpty;
import java.io.Serializable;

/**
 * <p>
 * 登录表
 * </p>
 *
 * @author whale.chen
 * @since 2021-11-22
 */
@TableName("t_login")
@Data
public class Login extends Model<Login> {

    private static final long serialVersionUID = 1L;

    @TableId(value = "id", type = IdType.AUTO)
    private Long id;

    @NotEmpty(message = "用户名不可为空")
    private String username;

    @NotEmpty(message = "密码不可为空")
    private String password;
    /**
     * 0是后台，1是前台
     */
    //@Max(value = 2)
    //@Min(value = 1,message = "最小值为1")
    private Integer type;

    @TableField("tenant_id")
    private Long tenantId;

    @TableField("tenant_name")
    private String tenantName;

    //@JsonInclude(JsonInclude.Include.NON_NULL)
    private Boolean enabled = true;
    @TableField("account_non_expired")
    private Boolean accountNonExpired  = true;
    @TableField("credentials_non_expired")
    private Boolean credentialsNonExpired  = true;
    @TableField("account_non_locked")
    private Boolean accountNonLocked  = true;



    @Override
    protected Serializable pkVal() {
        return this.id;
    }

}
